// When color definition differs for dark and light variant,
// it gets @if ed depending on $variant


$base_color: white;
$darkest_base_color: black;
@if $variant=='light' { $base_color: white; }

@if $variant=='dark' and $darkest=='false' { $base_color: #272a34; }

@if $variant=='dark' and $darkest=='true' { $base_color: $darkest_base_color; }

$text_color: if($variant == 'light', #5C616C, white);
$bg_color: #FAFAFA;
$darkest_bg_color: lighten($darkest_base_color, 5%);
@if $variant=='light' { $bg_color: #FAFAFA; }

@if $variant=='dark' and $darkest=='false' { $bg_color: darken(#272a34, 2%); }

@if $variant=='dark' and $darkest=='true' { $bg_color: $darkest_bg_color; }

$fg_color: if($variant =='light', #5C616C, white);

$selected_fg_color: white !default;
$selected_bg_color: #367BF0 !default;
$selected_borders_color: darken($selected_bg_color, 20%);

$borders_color: darken($bg_color, 9%);
@if $variant == 'dark' { $borders_color: darken($bg_color, 3%); }
@if $darkest == 'true' { $borders_color: lighten($bg_color, 5%); }

$link_color: if($variant == 'light', darken($selected_bg_color, 10%),
        lighten($selected_bg_color, 20%));
$link_visited_color: if($variant == 'light', darken($selected_bg_color, 20%),
        lighten($selected_bg_color, 10%));

$selection_mode_bg: transparentize($selected_bg_color, if($transparency=='false', 0, .2));
$selection_mode_fg: $selected_fg_color;
$warning_color: #F60;
$error_color: #D31919;
$warning_fg_color: white;
$error_fg_color: white;
$success_color: #19A187;
$destructive_color: #D31919;
$suggested_color: $selected_bg_color;
$destructive_fg_color: white;
$suggested_fg_color: $selected_fg_color;

$drop_target_color: #F60;

//insensitive state derived colors
$insensitive_fg_color: if($variant == 'light', transparentize($fg_color, 0.45), transparentize($fg_color, 0.55));
$insensitive_bg_color: if($variant == 'light', mix($bg_color, $base_color, 40%), lighten($bg_color, 2%));

$header_bg: transparentize(if($darker=='false', $base_color, black), if($transparency=='false', 0, .2));

$header_border: $borders_color;
@if $darker == 'true' { $header_border: $darkest_bg_color; }

$header_fg: if($variant == 'light', black, white);
$header_fg: if($darker == 'true', white, $header_fg);

$dark_sidebar_bg: black;
@if $variant=='light' or $darkest=='true' {
  $dark_sidebar_bg: transparentize(lighten(black, 3%), if($transparency=='true', if($variant=='light', 0.07, 0.025), 0));
} @else {
  $dark_sidebar_bg: transparentize(darken($bg_color, 2%), if($transparency == 'true', 0.05, 0));
}

$dark_sidebar_fg: white;
$dark_sidebar_border: if($variant == 'light', $dark_sidebar_bg, darken($dark_sidebar_bg, 5%));


$osd_fg_color: $dark_sidebar_fg;
$osd_bg_color: $dark_sidebar_bg;

$osd_button_bg: transparentize(lighten($osd_bg_color, 22%), 0.6);
$osd_button_border: transparentize(darken($osd_bg_color, 12%), 0.6);

$osd_entry_bg: transparentize(lighten($osd_bg_color, 22%), 0.6);
$osd_entry_border: transparentize(darken($osd_bg_color, 12%), 0.6);

$osd_insensitive_bg_color: darken($osd_bg_color, 3%);
$osd_insensitive_fg_color: mix($osd_fg_color, opacify($osd_bg_color, 1), 30%);
$osd_borders_color: transparentize(black, 0.3);

$panel_bg: transparentize($header_bg, if($transparency=='true', .3, 0));
$panel_fg: $header_fg;

$entry_bg: $base_color;
$entry_border: $borders_color;

$button_bg: if($variant == 'light', lighten($bg_color, 2%), lighten($base_color, 2%));
$button_border: $borders_color;

$header_button_bg: if($variant == 'light' and $darker == 'false', $base_color, lighten(opacify($header_bg, 1), 22%));
$header_button_border: if($variant == 'light' and $darker == 'false', darken($header_bg, 20%), $header_button_bg);

$header_entry_bg: $header_button_bg;
$header_entry_border: $header_button_border;

$trough_bg: if($variant=='light' and $darker=='false', opacify($header_entry_border, 0.05), $header_entry_border);

$tooltip_bg_color: #fbeaa0;
$tooltip_fg_color: #4a4a4a;
$tooltip_border_color: #d0d0d0;

$separator_color: if($variant == 'light', #cfcfcf, darken($bg_color, 6%));
